/**
 * 
 */
package org.istt.export;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.istt.model.FileBean;
import org.istt.model.FileReportBean;
import org.istt.model.GeneralReportBean;
import org.istt.web.WebConstants;

/**
 * @author Ndtho
 *
 */
public class ReportSynthesis extends BaseReport{
	
	public InputStream toMSWord(InputStream docFile, List<GeneralReportBean> lstReport, String fromDate, String toDate, String totalInMonth, String totalLastMonth, String title) throws IOException {
	    
		DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
		Date today = new Date();
		String date =  dateFormat.format(today);
		String strToday = "ng\u00E0y "+date.substring(0, 2)+" th\u00E1ng "+date.substring(3, 5)+" n\u0103m "+date.substring(6, 10) ;
		
		
		Calendar firstDate = new GregorianCalendar(NumberUtils.toInt(toDate.substring(6, 10))
				, NumberUtils.toInt(toDate.substring(3, 5)), NumberUtils.toInt(toDate.substring(0, 2)));
		Calendar secondDate = new GregorianCalendar(NumberUtils.toInt(fromDate.substring(6, 10))
				, NumberUtils.toInt(fromDate.substring(3, 5)), NumberUtils.toInt(fromDate.substring(0, 2)));
		
		int months  = (firstDate.get(Calendar.YEAR) - secondDate.get(Calendar.YEAR)) * 12 +
		       (firstDate.get(Calendar.MONTH)- secondDate.get(Calendar.MONTH)) + 
			       (firstDate.get(Calendar.DAY_OF_MONTH) >= secondDate.get(Calendar.DAY_OF_MONTH)? 0: -1); 
		
		
		String strVP_0 = "S\u1EDE X\u00C2Y D\u1EF0NG B\u00CCNH  D\u01AF\u01A0NG";
		String strVP_1 = "V\u0102N PH\u00D2NG S\u1EDE X\u00C2Y D\u1EF0NG B\u00CCNH  D\u01AF\u01A0NG";
		String strVP_Title = "B\u1ED8 PH\u1EACN TI\u1EBEP NH\u1EACN H\u1ED2 S\u01A0 V\u00C0 TR\u1EA2 K\u1EBET QU\u1EA2";
		
	    XWPFDocument docx = new XWPFDocument(docFile);
	    Iterator<XWPFTable> tableInDoc =docx.getTablesIterator();
	    
	    /*==================== HEADER ====================*/
	    XWPFTable tableHeader=tableInDoc.next();
	    
	    //Tieu de
	    XWPFTableRow header_row = tableHeader.getRow(0);
	    XWPFRun header_column = header_row.getCell(0).getParagraphs().get(0).createRun();
	    // Van phong So XD Binh Duong
	    if(StringUtils.isEmpty(title)){

	    	setTextFormat(header_column, strVP_1, FONT_SIZE_11, true, false, FONT_TIMES_NEW_ROMAN);
	    	
	    	header_row = tableHeader.getRow(1);
	    	header_column = header_row.getCell(0).getParagraphs().get(0).createRun();
	    	setTextFormat(header_column, strVP_Title, FONT_SIZE_11, true, false, FONT_TIMES_NEW_ROMAN);
	    }else{
	    	//So XD Binh Duong
	    	setTextFormat(header_column, strVP_0, FONT_SIZE_11, true, false, FONT_TIMES_NEW_ROMAN);
	    	
	    	header_row = tableHeader.getRow(1);
	    	header_column = header_row.getCell(0).getParagraphs().get(0).createRun();
	    	setTextFormat(header_column, StringUtils.upperCase(title), FONT_SIZE_11, true, false, FONT_TIMES_NEW_ROMAN);
	    	
	    }
	    
	    // Binh Duong, ngay... thang ... nam
	    header_row = tableHeader.getRow(3);
		header_row.getCell(2).getParagraphs().get(0).setAlignment(CENTER_ALIGN);
        header_column = header_row.getCell(2).getParagraphs().get(0).createRun();
        setTextFormat(header_column, strToday, FONT_SIZE_11, false, true, FONT_TIMES_NEW_ROMAN);
	    
	    String strDate = "(T\u1EEB ng\u00E0y " + fromDate	+ " \u0111\u1EBFn ng\u00E0y " + toDate + ")";
	    
	    // Thang...Nam/ ...thang
	    String strMonth = "";
	    
	    if(months > 1) // ...thang
	    	strMonth = months + " TH\u00C1NG" + ", N\u0102M " + toDate.substring(6,10);
	    else
	    	strMonth = "TH\u00C1NG " + toDate.substring(3,5) + ", N\u0102M " + toDate.substring(6,10);
	    
		List<XWPFParagraph> paragraphs = docx.getParagraphs();
		for (int i = 0; i < paragraphs.size(); i++)
		{
			XWPFParagraph paragraph = paragraphs.get(i);
			XWPFRun r = paragraph.createRun();
			switch(i)
			{
				case 1: //From date to date
					setTextFormat(r, strMonth, FONT_SIZE_11, true, false, FONT_TIMES_NEW_ROMAN);
					break;
				case 2: //From date to date
					setTextFormat(r, strDate, FONT_SIZE_11, true, true, FONT_TIMES_NEW_ROMAN);
					break;
			}
		}
		
		/*==================== STATISTIC RESULT ====================*/
		XWPFTable statisticTable=tableInDoc.next();
		XWPFTableRow statistic_row1 = statisticTable.getRow(0);
        XWPFRun statistic_column1 = statistic_row1.getCell(2).getParagraphs().get(0).createRun();
        statistic_column1.setText(totalLastMonth);
        statistic_column1.setFontSize(FONT_SIZE_11);

        XWPFTableRow statistic_row2 = statisticTable.getRow(1);
        XWPFRun statistic_column2 = statistic_row2.getCell(2).getParagraphs().get(0).createRun();
        statistic_column2.setText(totalInMonth);
        statistic_column2.setFontSize(FONT_SIZE_11);

        /*==================== BODY ====================*/
        XWPFTable contentTable=tableInDoc.next();
        
        generateRowContent(contentTable,lstReport);
        
	    //write to word file
	    ByteArrayOutputStream baos = new ByteArrayOutputStream();
	    docx.write(baos);
	    
	    return new ByteArrayInputStream(baos.toByteArray());
	}
	
	private void generateRowContent(XWPFTable contentTable, List<GeneralReportBean> lstReport){
		
		int depCount = 0;
		int categoryCount = 0;
		
	    if(lstReport!=null && lstReport.size()!=0){
	    	for (int i = 0; i < lstReport.size(); i++) {
	    		GeneralReportBean fileReportBean = (GeneralReportBean) lstReport.get(i);
	    		boolean isBold = false;
	    		XWPFTableRow header_row = contentTable.createRow();
	    		
	    		String cellVal = "";
	    		if (fileReportBean.getField().equals(WebConstants.SUM)) {
	    			cellVal = "";
	    			isBold = true;
	    		} else if (fileReportBean.getField().equals(WebConstants.DEP_NAME)) {
	    			char cno = (char) (65 + depCount);
	    			cellVal = Character.toString(cno);
	    			depCount++;
	    			categoryCount = 0;
	    			isBold = true;
	    		}else if (fileReportBean.getField().equals(WebConstants.CATE_NAME)) {
	    			categoryCount++;
	    			cellVal = String.valueOf(categoryCount);
	    		}
	    		
	    		//Number
				XWPFRun statistic_column = header_row.getCell(0).getParagraphs().get(0).createRun();
				header_row.getCell(0).getParagraphs().get(0).setSpacingAfter(SPACING_0);
				header_row.getCell(0).getParagraphs().get(0).setSpacingBefore(SPACING_06);
				header_row.getCell(0).getParagraphs().get(0).setAlignment(CENTER_ALIGN);
				statistic_column.setText(cellVal);
				statistic_column.setBold(isBold);
				statistic_column.setFontSize(FONT_SIZE_11);
	    		
	    		// Category
	    		XWPFRun category_column = header_row.getCell(1).getParagraphs().get(0).createRun();
	    		header_row.getCell(1).getParagraphs().get(0).setSpacingAfter(SPACING_0);
	    		header_row.getCell(1).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    		category_column.setText(fileReportBean.getCategory());
	    		category_column.setBold(isBold);
	    		category_column.setFontSize(FONT_SIZE_11);

	    		// Total received file in month
	    		XWPFRun column_TotalInMonth = header_row.getCell(2).getParagraphs().get(0).createRun();
	    		header_row.getCell(2).getParagraphs().get(0).setSpacingAfter(SPACING_0);
	    		header_row.getCell(2).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    		if(fileReportBean.getTotalInMonth()!=null)
	    			column_TotalInMonth.setText(fileReportBean.getTotalInMonth().equals("0")?"":fileReportBean.getTotalInMonth());
	    		column_TotalInMonth.setFontSize(FONT_SIZE_11);
	    		column_TotalInMonth.setBold(isBold);

	    		// Total resolved file in month
	    		if (fileReportBean.getResolvedInMonth()!=0) {
	    			XWPFRun column_TotalResolvedFileInMonth = header_row.getCell(3).getParagraphs().get(0).createRun();
	    			header_row.getCell(3).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(3).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalResolvedFileInMonth.setText(fileReportBean.getResolvedInMonth() + "");
	    			column_TotalResolvedFileInMonth.setFontSize(FONT_SIZE_11);
	    			column_TotalResolvedFileInMonth.setBold(isBold);
	    		}
	    		
	    		// Total resolved file on time
	    		if (fileReportBean.getResolvedOnTime()!=0) {
	    			XWPFRun column_TotalResolvedFileOnTime = header_row.getCell(4).getParagraphs().get(0).createRun();
	    			header_row.getCell(4).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(4).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalResolvedFileOnTime.setText(fileReportBean.getResolvedOnTime() + "");
	    			column_TotalResolvedFileOnTime.setFontSize(FONT_SIZE_11);
	    			column_TotalResolvedFileOnTime.setBold(isBold);
	    		}

	    		// Total resolved file over time
	    		header_row.createCell();
	    		if (fileReportBean.getTotalOverTime()!=0) {
	    			XWPFRun column_TotalResolvedFileOverTime = header_row.getCell(5).getParagraphs().get(0).createRun();
	    			header_row.getCell(5).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(5).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalResolvedFileOverTime.setText(fileReportBean.getTotalOverTime() + "");
	    			column_TotalResolvedFileOverTime.setFontSize(FONT_SIZE_11);
	    			column_TotalResolvedFileOverTime.setBold(isBold);
	    		}
	    		header_row.createCell();
	    		// Total files over time that less than 5
	    		if (fileReportBean.getOverTimeLessThanFive()!=0) {
	    			XWPFRun column_TotalOverTimeLessThanFive = header_row.getCell(6).getParagraphs().get(0).createRun();
	    			header_row.getCell(6).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(6).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalOverTimeLessThanFive.setText(fileReportBean.getOverTimeLessThanFive() + "");
	    			column_TotalOverTimeLessThanFive.setFontSize(FONT_SIZE_11);
	    			column_TotalOverTimeLessThanFive.setBold(isBold);
	    		}
	    		header_row.createCell();
	    		// Total files over time that between 5 and 10
	    		if (fileReportBean.getOverTimeBetweenFiveAndTen()!=0) {
	    			XWPFRun column_TotalOverTimeBetweenFiveAndTen = header_row.getCell(7).getParagraphs().get(0).createRun();
	    			header_row.getCell(7).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(7).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalOverTimeBetweenFiveAndTen.setText(fileReportBean.getOverTimeBetweenFiveAndTen() + "");
	    			column_TotalOverTimeBetweenFiveAndTen.setFontSize(FONT_SIZE_11);
	    			column_TotalOverTimeBetweenFiveAndTen.setBold(isBold);
	    		}
	    		header_row.createCell();
	    		// Total files over time that between 10 and 20
	    		if (fileReportBean.getOverTimeBetweenTenAndTwenty()!=0) {
	    			XWPFRun column_TotalOverTimeBetweenTenAndTwenty = header_row.getCell(8).getParagraphs().get(0).createRun();
	    			header_row.getCell(8).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(8).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalOverTimeBetweenTenAndTwenty.setText(fileReportBean.getOverTimeBetweenTenAndTwenty() + "");
	    			column_TotalOverTimeBetweenTenAndTwenty.setFontSize(FONT_SIZE_11);
	    			column_TotalOverTimeBetweenTenAndTwenty.setBold(isBold);
	    		}
	    		header_row.createCell();
	    		// Total files over time that more than 20
	    		if (fileReportBean.getOverTimeMoreThanTwenty()!=0) {
	    			XWPFRun column_TotalOverTimeMoreThanTwenty = header_row.getCell(9).getParagraphs().get(0).createRun();
	    			header_row.getCell(9).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(9).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalOverTimeMoreThanTwenty.setText(fileReportBean.getOverTimeMoreThanTwenty() + "");
	    			column_TotalOverTimeMoreThanTwenty.setFontSize(FONT_SIZE_11);
	    			column_TotalOverTimeMoreThanTwenty.setBold(isBold);
	    		}
	    		header_row.createCell();
	    		// Total files that have not approved
	    		if (fileReportBean.getTotalNotApproved()!=0) {
	    			XWPFRun column_TotalNotApproved = header_row.getCell(10).getParagraphs().get(0).createRun();
	    			header_row.getCell(10).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(10).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalNotApproved.setText(fileReportBean.getTotalNotApproved() + "");
	    			column_TotalNotApproved.setFontSize(FONT_SIZE_11);
	    			column_TotalNotApproved.setBold(isBold);
	    		}
	    		header_row.createCell();
	    		// Total files that have approved before deadline
	    		if (fileReportBean.getNotApprovedBeforeDeadline()!=0) {
	    			XWPFRun column_TotalNotApproved = header_row.getCell(11).getParagraphs().get(0).createRun();
	    			header_row.getCell(11).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(11).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalNotApproved.setText(fileReportBean.getNotApprovedBeforeDeadline() + "");
	    			column_TotalNotApproved.setFontSize(FONT_SIZE_11);
	    			column_TotalNotApproved.setBold(isBold);
	    		}
	    		header_row.createCell();
	    		// Total files that have approved before deadline
	    		if (fileReportBean.getNotApprovedOverdue()!=0) {
	    			XWPFRun column_TotalNotApprovedOverdue = header_row.getCell(12).getParagraphs().get(0).createRun();
	    			header_row.getCell(12).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		    		header_row.getCell(12).getParagraphs().get(0).setSpacingBefore(SPACING_06);
	    			column_TotalNotApprovedOverdue.setText(fileReportBean.getNotApprovedOverdue() + "");
	    			column_TotalNotApprovedOverdue.setFontSize(FONT_SIZE_11);
	    			column_TotalNotApprovedOverdue.setBold(isBold);
	    		}
	    	}
	    }
	    
		
	}
	
	
	private void generateTableReport(XWPFDocument docx, FileReportBean fileReportBean){
		XWPFParagraph para = docx.createParagraph();
		
		XWPFRun r = para.createRun();
		r.setBold(true);
		r.setFontFamily(FONT_TIMES_NEW_ROMAN); 
		r.setText("PH\u00D2NG: "+fileReportBean.getDepartment().toUpperCase());
		
		//Header
        XWPFTable tableHeader=docx.createTable();
		XWPFTableRow row = tableHeader.getRow(0);
		createTableHeader(row);
		
		List<FileBean> lstFile = fileReportBean.getLstFile();
		if(lstFile.size()!=0){
			int rowcount = 1;
			for (Iterator<FileBean> iterator = lstFile.iterator(); iterator.hasNext();) {
				FileBean fileBean = (FileBean) iterator.next();
				XWPFTableRow content_row = tableHeader.createRow();
				generateRow(fileBean, content_row, rowcount);
				
				rowcount++;
			}
		}
	}
	
	private void generateRow(FileBean fileBean, XWPFTableRow content_row,int rowNo){
		//No
		XWPFRun stt_column = content_row.getCell(0).getParagraphs().get(0).createRun();
		stt_column.setText(rowNo+"");
		stt_column.setFontSize(FONT_SIZE_10);
		
		// Sender
		XWPFRun sender_column = content_row.getCell(1).getParagraphs().get(0).createRun();
		content_row.getCell(1).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(1).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		sender_column.setText(fileBean.getSender());
		sender_column.setFontSize(FONT_SIZE_10);

		// address: the location of building or address of sender
		XWPFRun location_column = content_row.getCell(2).getParagraphs().get(0).createRun();
		content_row.getCell(2).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(2).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		location_column.setFontSize(FONT_SIZE_10);
		if(fileBean.getLocation()!=null)
			location_column.setText(fileBean.getLocation());
		
		// category
		XWPFRun category_column = content_row.getCell(3).getParagraphs().get(0).createRun();
		content_row.getCell(3).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(3).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		category_column.setFontSize(FONT_SIZE_10);
		category_column.setText(fileBean.getCategory());

		// submit date
		XWPFRun inputDate_column = content_row.getCell(4).getParagraphs().get(0).createRun();
		content_row.getCell(4).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(4).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		inputDate_column.setFontSize(FONT_SIZE_10);
		inputDate_column.setText(fileBean.getInputDate());

		// the date that the processing department receives file
		XWPFRun dateCm_column = content_row.getCell(5).getParagraphs().get(0).createRun();
		content_row.getCell(5).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(5).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		dateCm_column.setFontSize(FONT_SIZE_10);
		dateCm_column.setText(fileBean.getDateReceiveFileProcess());

		// The person who receives the file for processing
		XWPFRun receiverCm_column = content_row.getCell(6).getParagraphs().get(0).createRun();
		content_row.getCell(6).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(6).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		receiverCm_column.setFontSize(FONT_SIZE_10);
		receiverCm_column.setText(fileBean.getWhoReceiveFileProcess());

		// the date returns the file to onegate department.
		XWPFRun dateOnegate_column = content_row.getCell(7).getParagraphs().get(0).createRun();
		content_row.getCell(7).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(7).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		dateOnegate_column.setFontSize(FONT_SIZE_10);
		dateOnegate_column.setText(fileBean.getDateReceiveFileOnegate());
		
		// the person who receives the file from processing department
		XWPFRun receiverOnegate_column = content_row.getCell(8).getParagraphs().get(0).createRun();
		content_row.getCell(8).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(8).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		receiverOnegate_column.setFontSize(FONT_SIZE_10);
		receiverOnegate_column.setText(fileBean.getWhoReceiveFileOnegate());

		// the date that returns file to sender (for planing)
		XWPFRun outputDate_column = content_row.getCell(9).getParagraphs().get(0).createRun();
		content_row.getCell(9).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(9).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		outputDate_column.setFontSize(FONT_SIZE_10);
		outputDate_column.setText(fileBean.getOutputDate());

		// the date that sender receives the file
		XWPFRun getResultDate_column = content_row.getCell(10).getParagraphs().get(0).createRun();
		content_row.getCell(10).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(10).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		getResultDate_column.setFontSize(FONT_SIZE_10);
		getResultDate_column.setText(fileBean.getReturnDate());

		// Person gets the file that has approved by agent 
		XWPFRun personGetResult_column = content_row.getCell(11).getParagraphs().get(0).createRun();
		content_row.getCell(11).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(11).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		personGetResult_column.setFontSize(FONT_SIZE_10);
		personGetResult_column.setText(fileBean.getWhoGetResult());

		// The processing result of file
		XWPFRun result_column = content_row.getCell(12).getParagraphs().get(0).createRun();
		content_row.getCell(12).getParagraphs().get(0).setSpacingAfter(SPACING_0);
		content_row.getCell(12).getParagraphs().get(0).setSpacingBefore(SPACING_06);
		result_column.setFontSize(FONT_SIZE_10);
		result_column.setText(fileBean.getResult());

	}
	
	private void createTableHeader(XWPFTableRow header_row){
		String[] headerTitle = {"T\u00EAn c\u00E1 nh\u00E2n/ c\u01A1 quan",
				"\u0110\u1ECBa \u0111i\u1EC3m",
				"Lo\u1EA1i th\u1EE7 t\u1EE5c",
				"Ng\u00E0y n\u1ED9p",
				"Ng\u00E0y nh\u1EADn (ph\u00F2ng CM)",
				"Ng\u01B0\u1EDDi nh\u1EADn (ph\u00F2ng CM)",
				"Ng\u00E0y nh\u1EADn (Ph\u00F2ng 1 c\u1EEDa)",
				"Ng\u01B0\u1EDDi nh\u1EADn (Ph\u00F2ng 1 c\u1EEDa)",
				"Ng\u00E0y h\u1EB9n tr\u1EA3",
				"Ng\u00E0y tr\u1EA3",
				"Ng\u01B0\u1EDDi nh\u1EADn",
				"K\u1EBFt qu\u1EA3 gi\u1EA3i quy\u1EBFt",
				"Ghi ch\u00FA"};

		XWPFRun stt_column = header_row.getCell(0).getParagraphs().get(0).createRun();
		stt_column.setText("STT");
		stt_column.setBold(true);
		stt_column.setFontFamily(FONT_TIMES_NEW_ROMAN); 
		stt_column.setFontSize(FONT_SIZE_10);
		
		for (int i = 0; i < headerTitle.length; i++) {
			
			header_row.createCell();
			XWPFRun header_colum = header_row.getCell(i+1).getParagraphs().get(0).createRun();
			header_row.getCell(i+1).getParagraphs().get(0).setAlignment(CENTER_ALIGN);
			header_colum.setText(headerTitle[i]);
			header_colum.setBold(true);
			header_colum.setFontFamily(FONT_TIMES_NEW_ROMAN); 
			header_colum.setFontSize(FONT_SIZE_10);

		}
	}
}
